﻿<UserControl x:Class="KouDai.Phone.Views.ImageWallView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:WPNext="clr-namespace:WPNextTools.NControls;assembly=WPNextTools"
             xmlns:cal="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:vm="clr-namespace:KouDai.Phone.ViewModels"
             FontFamily="{StaticResource PhoneFontFamilyNormal}"
             FontSize="{StaticResource PhoneFontSizeNormal}"
             Foreground="{StaticResource PhoneForegroundBrush}"
             d:DataContext="{d:DesignInstance Type=vm:ImageWallViewModel,
                                              IsDesignTimeCreatable=True}"
             d:DesignHeight="800"
             d:DesignWidth="480"
             mc:Ignorable="d">

    <Grid x:Name="LayoutRoot" Background="Transparent">
        <WPNext:PhotoListBox x:Name="HotDetailImageWall"
                             HeaderContent="松开可以刷新..."
                             ItemsSource="{Binding Items}"
                             LoadingContent="加载中...">
            <WPNext:PhotoListBox.StrategyDefinition>
                <WPNext:PhotoVirtualizationStrategyDefinition ColumnCount="3"
                                                              ColumnMargin="5"
                                                              LeftRightMargin="12"
                                                              Orientation="Vertical" />
            </WPNext:PhotoListBox.StrategyDefinition>
            <WPNext:PhotoListBox.ItemTemplate>
                <DataTemplate>
                    <Grid Background="LightGray">
                        <Image Source="{Binding ImageUrlForIphone}" />
                    </Grid>
                </DataTemplate>
            </WPNext:PhotoListBox.ItemTemplate>

            <i:Interaction.Triggers>
                <i:EventTrigger EventName="ScrolledToBottom">
                    <cal:ActionMessage MethodName="GetImageWall" />
                </i:EventTrigger>

                <i:EventTrigger EventName="StretchedFromTop">
                    <cal:ActionMessage MethodName="PullDownToFresh" />
                </i:EventTrigger>

                <i:EventTrigger EventName="ItemTap">
                    <cal:ActionMessage MethodName="ImageTap">
                        <cal:Parameter Value="{Binding Path=SelectedItem, ElementName=HotDetailImageWall}" />
                    </cal:ActionMessage>
                </i:EventTrigger>

            </i:Interaction.Triggers>
        </WPNext:PhotoListBox>
    </Grid>
</UserControl>